package com.hanbang.myapplication;

import android.app.Activity;
import android.os.Bundle;

import com.hanbang.myapplication.alipay.Alipay;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.Random;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
//        PushManager.startWork(getApplicationContext(), PushConstants.LOGIN_TYPE_API_KEY, "LPat4HfdGSgGmgSianQMiclQ");
//        List<String> tag = new ArrayList<>();
//        tag.add("18012084251");
//        PushManager.setTags(this, tag);

        new Alipay(this).alipay("测试的商品", "该测试商品的详细描述", "0.01", "B201602241359060000000001567");

    }

    /**
     * 生成商户订单号，该值在商户端应保持唯一（可自定义格式规范）
     */
    private String getOutTradeNo() {
        SimpleDateFormat format = new SimpleDateFormat("MMddHHmmss", Locale.getDefault());
        Date date = new Date();
        String key = format.format(date);

        Random r = new Random();
        key = key + r.nextInt();
        key = key.substring(0, 15);
        return key;
    }

    final class InJavaScriptLocalObj {
        public void showSource(String html) {
            System.out.println("====>html=" + html);
        }
    }
}
